const SERVICE = require("../../lib/js/service.js");

Page({
  data:{
    ActiveNavItem: 0,
    nav: ["车况优秀", "车况良好","车况一般"]
  },
  
  onLoad(options){
    let _this = this, params = JSON.parse(options.params);
    wx.showLoading({
      title: "估价中...",
      mask: true
    });
    SERVICE.POST(SERVICE.URL.getUsedCarPrice, {
      modelId: params.model_id,
      regDate: params.regDate,
      mile: params.mile,
      zone: params.zone
    }, (status, res) => {
      wx.hideLoading();
      if (res.data.status == 1) {
        params.regDate = params.regDate.replace(/\-/, "年") + '月';
        console.log(res);
        _this.setData({
          params: params,
          detail: res.data
        });
      } else {
        wx.showToast({
          title: "获取失败",
          icon: "none",
          mask: true
        })
      }
    });
  },

  /*分享*/
  onShareAppMessage(){

  },
  
  /*获取导航*/ 
  getNavItem(e){
    let ActiveNavItem = e.currentTarget.dataset.index;
    this.setData({
      ActiveNavItem
    });
  }
});